package com.wx.service.demo.utils;

import android.content.Context;

import java.io.InputStream;

public class Utils {

    public static String readStringFromAssets(Context context, String fileName) {
        String result = "";
        InputStream is = null;
        try {
            is = context.getAssets().open(fileName);
            int length = is.available();
            byte[] buffer = new byte[length];
            is.read(buffer);
            result = new String(buffer, "utf8");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (Exception e) {

                }
            }
        }
        return result;
    }
}
